﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="DMAnChi.ascx.cs" Inherits="DanhMuc_DMAnChi" %>
<center>

    <asp:Panel ID="pnGroupGrid" runat="server" Width="700px">
    <span class="SubHead">Đợt phát hành:</span> 
<asp:DropDownList runat="server" ID="cboDotPhatHanh" DataSourceID="dsDotPhatHanh" DataTextField="TenDot" DataValueField="id" AutoPostBack="True" OnSelectedIndexChanged="cboDotPhatHanh_SelectedIndexChanged"></asp:DropDownList>
<br /><br />
        <asp:DataGrid ID="datagrid" runat="server" AllowPaging="True" AutoGenerateColumns="False"
            OnItemCommand="datagrid_ItemCommand" OnItemDataBound="datagrid_ItemDataBound"
            OnPageIndexChanged="datagrid_PageIndexChanged" PageSize="20" Width="100%" DataSourceID="SqlDataSource1" OnPreRender="datagrid_PreRender">
            <PagerStyle Mode="NumericPages" />
            <AlternatingItemStyle CssClass="DarkRow" />
            <ItemStyle CssClass="LightRow" />
            <Columns>
                <asp:BoundColumn HeaderText="M&#227;" DataField="Ma"></asp:BoundColumn>
                <asp:BoundColumn HeaderText="M&#227; loại ấn chỉ 1" DataField="MaLoaiAnChi1" Visible="False"></asp:BoundColumn>
                <asp:BoundColumn HeaderText="Loại ấn chỉ" DataField="MaLoaiAnChi"></asp:BoundColumn>
                <asp:BoundColumn HeaderText="M&#227; (nhóm) ấn chỉ" DataField="MaAnChi"></asp:BoundColumn>
                <asp:BoundColumn HeaderText="T&#234;n ấn chỉ" DataField="TenAnChi">
                    <ItemStyle HorizontalAlign="Left" />
                </asp:BoundColumn>
                <asp:BoundColumn HeaderText="Đợt ph&#225;t h&#224;nh" DataField="TenDot" Visible="False"></asp:BoundColumn>
                <asp:BoundColumn HeaderText="M&#227; - Đơn gi&#225;" DataField="Ma_DonGia" Visible="False"></asp:BoundColumn>
                <asp:BoundColumn HeaderText="Đơn giá (mệnh giá)" DataField="DonGia"></asp:BoundColumn>
                <asp:BoundColumn HeaderText="Loại tiền" DataField="LoaiTien"></asp:BoundColumn>
                                
                <asp:TemplateColumn HeaderText="Ấn chỉ mẫu">
                    <ItemTemplate>
                        <asp:CheckBox Enabled="false" Checked='<%# DataBinder.Eval(Container.DataItem, "AnChiMau") %>'
                            ID="grid_cbAnChiMau" runat="server" CausesValidation="False" Text="" Width="40" />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateColumn>
                <asp:BoundColumn HeaderText="Cho phép đồng bộ từ HOST" DataField="XuatKHTrongQLAC"></asp:BoundColumn>
                <asp:TemplateColumn>
                    <ItemTemplate>
                        <asp:Button ID="cmdEdit" runat="server" CausesValidation="False" CommandName="cmdEdit"
                            Text="Sửa" Width="40" />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateColumn>
                <asp:TemplateColumn>
                    <ItemTemplate>
                        <asp:Button CausesValidation="False" ID="cmdDelete" runat="server" Text="Xóa" Width="40"
                            CommandName="cmdDelete"></asp:Button>
                    </ItemTemplate>
                </asp:TemplateColumn>
            </Columns>
            <HeaderStyle CssClass="HeaderRow" Font-Bold="True" />
        </asp:DataGrid><asp:SqlDataSource ID="ds" runat="server" ConnectionString="<%$ ConnectionStrings:DBConnectionString %>"
            ProviderName="<%$ ConnectionStrings:DBConnectionString.ProviderName %>"></asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DBConnectionString %>"
            ProviderName="<%$ ConnectionStrings:DBConnectionString.ProviderName %>" SelectCommand="MaAnChi_getDotPhatHanh" SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:ControlParameter ControlID="cboDotPhatHanh" Name="MaDotPhatHanh" PropertyName="SelectedValue" />
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:Button ID="cmdAddNew" runat="server" OnClick="cmdAddNew_Click" Text="Thêm mới" />
    </asp:Panel>
    <asp:Panel ID="pnEdit" runat="server" Width="100%">
        <table border="0" cellpadding="0" cellspacing="5" class="Area" style="border-right: gray 1px solid;
            border-top: gray 1px solid; border-left: gray 1px solid; border-bottom: gray 1px solid"
            width="100%">
            <tr>
                <td align="center" colspan="4" style="color: blue">
                    <asp:Label ID="Label1" runat="server"></asp:Label></td>
            </tr>
            <tr>
                <td colspan="4" style="text-align: center">
                    <asp:TextBox ID="txtId" runat="server" Enabled="true"
                        ReadOnly="True" Visible="False"></asp:TextBox>
                        <span class="SubHead">Đợt phát hành:</span> 
<asp:DropDownList runat="server" ID="cboDotPhatHanh_edit" DataSourceID="dsDotPhatHanh" DataTextField="TenDot" DataValueField="id" AutoPostBack="True"></asp:DropDownList>
                    <asp:SqlDataSource ID="dsDotPhatHanh" runat="server" ConnectionString="<%$ ConnectionStrings:DBConnectionString %>" ProviderName="<%$ ConnectionStrings:DBConnectionString.ProviderName %>" SelectCommand="Select '-1' as [id], N'Tất cả các đợt' as TenDot&#13;&#10;union&#13;&#10;select  [id], tendot from DotPhatHanh"></asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td width="20%" style="text-align: left">
                    Loại ấn chỉ</td>
                <td width="30%" style="text-align: left">
                    <asp:DropDownList ID="ddlMaLoaiAnChi" runat="server" Enabled="true" Visible="true"
                        Width="200px">
                        <asp:ListItem Text="Ấn chỉ thường" Value="1"></asp:ListItem>
                        <asp:ListItem Text="Ấn chỉ quan trọng" Value="0"></asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td width="20%" style="text-align: left">
                    <asp:CheckBox ID="cbAnChiMau" runat="server" Text="Là ấn chỉ mẫu" /></td>
                <td width="30%" style="text-align: left">
                     <asp:CheckBox ID="chkXuatKH" runat="server" Text="Cho phép đồng bộ từ HOST" /></td>
            </tr>
            <tr>
                <td style="text-align: left">
                    Tên ấn chỉ</td>
                <td colspan="3" style="text-align: left">
                    <asp:TextBox ID="txtTenAnChi" runat="server" Enabled="true" Visible="true" Width="548px"></asp:TextBox></td>
            </tr>
            <tr>
                <td style="text-align: left">
                    Đơn giá (mệnh giá)</td>
                <td style="text-align: left">
                    <asp:TextBox ID="txtDonGia" runat="server" Enabled="true" Visible="true" Width="145px"></asp:TextBox>
                    <asp:DropDownList runat="server" ID="cboLoaiTien" Width="50px">
                        <asp:ListItem Selected="True" Text="VND" Value="VND"></asp:ListItem>
                        <asp:ListItem Text="USD" Value="USD"></asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td style="text-align: left">
                    Đơn vị tính</td>
                <td style="text-align: left">
                    <asp:DropDownList ID="cboDonViTinh" runat="server" Width="128px">
                        <asp:ListItem Value="Tờ" Text="Tờ"></asp:ListItem>
                        <asp:ListItem Value="Quyển" Text="Quyển"></asp:ListItem>
                    </asp:DropDownList></td>
            </tr>
            <tr style="border-top: 1px solid blue;">
                <td style="text-align: left">
                    Mã nhóm ấn
                    &nbsp;chỉ</td>
                <td style="text-align: left">
                    <asp:TextBox ID="txtMaAnChi" runat="server" Enabled="true" Visible="true" Width="200px"></asp:TextBox></td>
                <td>
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td style="text-align: left">
                    Tên nhóm ấn chỉ</td>
                <td colspan="3" style="text-align: left">
                    <asp:TextBox ID="txtTenNhom" runat="server" Enabled="true" Visible="true" Width="548px"></asp:TextBox></td>
            </tr>
            <tr>
                <td style="color: red; font-family: arial" align="center" colspan="4" height="10">
                    <asp:Label ID="lblError" runat="server"></asp:Label><asp:Label ID="lblUpdateStatus"
                        runat="server"></asp:Label></td>
            </tr>
            <tr>
                <td align="center" colspan="4">
                    <asp:Button ID="cmdUpdate" runat="server" CausesValidation="true" OnClick="cmdUpdate_Click"
                        Text="Cập nhật" Width="72px" />
                    <asp:Button ID="cmdCancel" runat="server" CausesValidation="False" OnClick="cmdCancel_Click"
                        Text="Quay lại" Width="72" /></td>
            </tr>
        </table>
    </asp:Panel>
</center>
